<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI</title>
<link rel="stylesheet" type="text/css" href="../css/hui.css" />
</head>
<body>
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>HUI 星级评分组件</h1>
</header>
<div class="hui-wrap">
	<div class="hui-common-title" style="margin-top:15px;">
		<div class="hui-common-title-line"></div>
		<div class="hui-common-title-txt">星级评分演示</div>
		<div class="hui-common-title-line"></div>
	</div>
	<div style="padding:0px 28px;">
        <div id="star1" style="padding:22px 0px;"></div>
        <button type="button" class="hui-button hui-button-large" id="btn1">提交评分</button>
    </div>
    <div class="hui-center-title" style="margin-top:50px;"><h1>自定义 + 事件监听</h1></div>
    <div style="padding:5px 28px;">
        <div id="star2" style="padding:22px 0px;"></div>
        <button type="button" class="hui-button hui-button-large" id="btn2">提交评分</button>
    </div>
</div>
<script src="../js/hui.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/hui-star.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var star1 = new huiStar('#star1');
star1.draw();
//默认3星
hui('#star1').find('.hui-icons-star').eq(2).trigger('click');
//事件监听
hui('#btn1').click(function(){
    var starVal = star1.getVal();
    hui.iconToast('星级 : ' + starVal, 'star');
});

var star2 = new huiStar('#star2');
star2.starNum = 6;
star2.color   = '#D1D1D1';
star2.colorActive = '#FF0000';
star2.size = 28;
star2.change = function(starVal){
    hui.toast(starVal + '星');
}
star2.draw();
hui('#btn2').click(function(){
    var starVal = star2.getVal();
    hui.iconToast('星级 : ' + starVal, 'star');
});
</script>
</body>
</html>